import axios from 'axios'
import Vue from 'vue'
import { Toast } from 'vant'

Vue.use(Toast)

axios.interceptors.request.use(cfg => {
  Toast.loading({
    message: '加载中...',
    forbidClick: true
  })
  return cfg
})
axios.interceptors.response.use(res => {
  if (res.data.status !== 0) {
    Toast.fail('网络繁忙')
  }
  return res
})
export default axios
